import React, { useState, useEffect } from 'react';
import { observer } from 'mobx-react-lite';
import { Dialog } from '@alifd/next';
import { t } from '@lingui/macro';
import { useStore } from '@/hooks';
import DIChargeForm from './DIChargeForm';

const DialogChange = ({ dICurCharge, setDICurCharge, dIChargeOnSubmit }) => {
  const { ruleStore } = useStore();
  return (
    <Dialog
      visible={!!dICurCharge}
      onCancel={() => setDICurCharge(false)}
      onClose={() => setDICurCharge(false)}
      title={t`编辑司机`}
      style={{ ..._SIZE_DIALOG_VALUE._member_vehicle[ruleStore._device] }}
      footer={null}
    >
      <DIChargeForm
        data={dICurCharge}
        onSubmit={(r, errors) => dIChargeOnSubmit(r, errors)}
        onCancel={() => setDICurCharge(false)}
      />
    </Dialog>);
};

export default observer(DialogChange);
